<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

/**
 * 资产管理验证器
 */
class AssetValidate extends Validate
{
    /**
     * 定义验证规则
     */
    protected $rule = [
        'name' => 'require',
        'address' => 'require',
        'amount' => 'require',
        'latitude' => 'require',
        'longitude' => 'require',
        'mainImage' => 'require',
        'created_time' => 'require',
        'updated_time' => 'require',
    ];

    /**
     * 定义错误信息
     */
    protected $message = [
        'name' => '资产名称必须填写',
        'address' => '资产地址必须填写',
        'amount' => '资产金额必须填写',
        'latitude' => '纬度必须填写',
        'longitude' => '经度必须填写',
        'mainImage' => '主图片URL必须填写',
        'created_time' => '创建时间必须填写',
        'updated_time' => '更新时间必须填写',
    ];

    /**
     * 定义场景
     */
    protected $scene = [
        'save' => [
            'name',
            'address',
            'amount',
            'latitude',
            'longitude',
            'mainImage',
            'created_time',
            'updated_time',
        ],
        'update' => [
            'name',
            'address',
            'amount',
            'latitude',
            'longitude',
            'mainImage',
            'created_time',
            'updated_time',
        ],
    ];

}
